package com.lightsh.object;

import org.jbox2d.common.Vec2;

import android.util.Log;

import com.lightsh.gui.BaseScreen;
import com.lightsh.interfaces.creator.IBodyCreator;

/**
 * 普通物体的父类,这个类主要完成了简单的信息记录，如绘制层次、图形位置以及角度、可见度等
 * @author Light
 *
 */
public abstract class SimpleObject extends BaseObject implements IBodyCreator{
	protected BaseScreen mParentScreen;
	private boolean mbCreated = false;
	protected Vec2 mPosition;
	private boolean mVisible = true;
	protected float mAngle = 0;
	
	public SimpleObject(BaseScreen screen, float x, float y){
		mParentScreen = screen;
		mPosition = new Vec2(x, y);
	}
	@Override
	public Vec2 getPosition() {
		return mPosition.clone();
	}
	
	public void setVisible(boolean visible){
		mVisible = visible;
	}
	public boolean isVisible(){
		return mVisible;
	}

	@Override
	public void create() {
		if(mbCreated){
			throw new RuntimeException("object had been created!");
		}
		mbCreated = true;
	}
	
}
